﻿ using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
using LiuYan.Entity;
using LiuYan.Service;

namespace LiuYan.Web.Areas.Admin.Controllers
{
    public class ExpressController : BaseController
    {
        //
        // GET: /Admin/Express/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Window(int id)
        {
            ViewData["id"] = id;
            return View();
        }

        public string GetOneData(int id)
        {
            return JsonConvert.SerializeObject(new BaseService().GetOneData(id, "TB_Express"));
        }

        public int Edit(FormCollection form)
        {
            TB_Express entity = new TB_Express();
            entity.Id = Convert.ToInt32(form["id"]);
            entity.ExpressName = form["name"];
            return new ExpressService().Edit(entity);
        }

        public string GetList(int pageIndex, int pageCount, string title)
        {
            return JsonConvert.SerializeObject(new ExpressService().GetList(pageIndex, pageCount, title));
        }

        public int Del(string ids)
        {
            return new BaseService().Dels(ids, "TB_Express", false);
        }
    }
}
